# eric7.PipInterface.PipPackagesWidget

Module implementing the pip packages management widget.

### Global Attributes

None

### Classes

PipPackageInformationMode | Class defining the show information process modes.
PipPackagesWidget | Class implementing the pip packages management widget.

### Functions

None

## PipPackageInformationMode

Class defining the show information process modes.

### Derived from

enum.Enum

### Class Attributes

Classifiers
EntryPoints
FilesList
General
UrlsList

### Class Methods

None

### Methods

None

### Static Methods

None

Up

## PipPackagesWidget

Class implementing the pip packages management widget.

### Derived from

QWidget, Ui_PipPackagesWidget

### Class Attributes

AvailableVersionColumn
DepInstalledVersionColumn
DepPackageColumn
DepRequiredVersionColumn
InstalledVersionColumn
PackageColumn
SearchVersionRole
VulnerabilityColumn
VulnerabilityRole

### Class Methods

None

### Methods

PipPackagesWidget | Constructor
__aboutToShowPipMenu | Private slot to set the action enabled status.
__addDependency | Private method to add a dependency branch to a given parent.
__allPackageNames | Private method to get a list of all package names.
__allUpdateableItems | Private method to get a list of all items that can be updated.
__availablePipVersion | Private method to get the pip version of the selected environment.
__checkVulnerability | Private slot to update and show the vulnerability data (called from the menu).
__clearVulnerabilityInfo | Private slot to clear the vulnerability info.
__createSBOMFile | Private slot to create a "Software Bill Of Material" file.
__editConfiguration | Private slot to edit a configuration.
__editVirtualenvConfiguration | Private slot to edit the configuration of the selected environment.
__generateRequirements | Private slot to generate the contents for a requirements or constraints file.
__initPipMenu | Private method to create the super menu and attach it to the super menu button.
__installLocalPackage | Private slot to install a package available on local storage.
__installPackages | Private slot to install packages to be given by the user.
__installPip | Private slot to install pip into the selected environment.
__installPipUser | Private slot to install pip into the user site for the selected environment.
__installPyprojectDependencies | Private slot to install packages as given in a 'pyproject.toml' file.
__installRequirements | Private slot to install packages as given in a requirements file.
__isPipAvailable | Private method to check, if the pip package is available for the selected environment.
__pipConfigure | Private slot to open the configuration page.
__populateEnvironments | Private method to get a list of environments and populate the selector.
__projectClosed | Private slot to handle the projectClosed signal.
__projectOpened | Private slot to handle the projectOpened signal.
__purgeCache | Private slot to empty the pip cache.
__refreshDependencyTree | Private slot to refresh the dependency tree.
__refreshPackagesList | Private slot to refresh the packages list.
__reinstallPackages | Private slot to force a re-installation of the selected packages.
__removeCachedFiles | Private slot to remove files from the pip cache.
__repairPip | Private slot to repair the pip installation of the selected environment.
__resetPackageSearchHighlight | Private method to reset the package search marker of an individual item.
__resetPackageSearchHighlights | Private method to reset the package search markers.
__selectedUpdateableItems | Private method to get a list of selected items that can be updated.
__setPackageSearchHighlights | Private method to highlight the given package items.
__showCacheInfo | Private slot to show information about the cache.
__showCacheList | Private slot to show a list of cached files.
__showLicensesDialog | Private slot to show a dialog with the licenses of the selected environment.
__showPackageDetails | Private method to populate the package details dialog.
__showPackageInformation | Private method to show information for a package.
__showVulnerabilityInformation | Private method to show the detected vulnerability data.
__uninstallPyprojectDependencies | Private slot to uninstall packages as given in a 'pyproject.toml' file.
__uninstallRequirements | Private slot to uninstall packages as given in a requirements file.
__updateActionButtons | Private method to set the state of the action buttons.
__updateDepActionButtons | Private method to set the state of the dependency page action buttons.
__updateOutdatedInfo | Private method to process the list of outdated packages.
__updateVulnerabilityData | Private slot to update the shown vulnerability info.
__updateVulnerabilityDbCache | Private slot to initiate an update of the local cache of the vulnerability database.
executeInstallPackages | Public method to install the given list of packages.
executeUninstallPackages | Public method to uninstall the given list of packages.
executeUpgradePackages | Public method to execute the pip upgrade command.
getPip | Public method to get a reference to the pip interface object.
on_cleanupButton_clicked | Private slot to cleanup the site-packages directory of the selected environment.
on_dependenciesList_itemActivated | Private slot reacting on a package item of the dependency tree being activated.
on_dependenciesList_itemPressed | Private slot reacting on a package item of the dependency tree being pressed.
on_dependenciesList_itemSelectionChanged | Private slot reacting on a change of selected items of the dependency tree.
on_dependencyRepairAllButton_clicked | Private slot to repair all dependencies.
on_dependencyRepairButton_clicked | Private slot to repair all selected dependencies.
on_environmentsComboBox_currentTextChanged | Private slot handling the selection of a Python environment.
on_includeGlobalsButton_clicked | Private slot to handle a change of the 'Include Global Environments' button.
on_packageSearchEdit_textChanged | Private slot to search packages in the dependencies tree.
on_packagesList_itemActivated | Private slot reacting on a package item being activated.
on_packagesList_itemSelectionChanged | Private slot reacting on a change of selected items.
on_refreshButton_clicked | Private slot to refresh the display.
on_refreshDependenciesButton_clicked | Private slot to refresh the dependency tree.
on_searchButton_clicked | Private slot to open a web browser for package searching.
on_showDepPackageDetailsButton_clicked | Private slot to show information for the selected package of the dependency tree.
on_showPackageDetailsButton_clicked | Private slot to show information for the selected package.
on_uninstallButton_clicked | Private slot to remove selected packages of the selected environment.
on_upgradeAllButton_clicked | Private slot to upgrade all packages of the selected environment.
on_upgradeButton_clicked | Private slot to upgrade selected packages of the selected environment.
on_viewToggleButton_toggled | Private slot handling the view selection.
on_vulnerabilityCheckBox_toggled | Private slot handling a change of the automatic vulnerability checks.
preferencesChanged | Public slot to handle a change of preferences.
setVulnerabilityEnabled | Public slot to set the enabled state of the vulnerability checks.

### Static Methods

None

#### PipPackagesWidget (Constructor)

PipPackagesWidget(pip, parent=None)

Constructor

pip (Pip)
  reference to the global pip interface
parent (QWidget (optional))
  reference to the parent widget (defaults to None)

#### PipPackagesWidget.__aboutToShowPipMenu

__aboutToShowPipMenu()

Private slot to set the action enabled status.

#### PipPackagesWidget.__addDependency

__addDependency(dependency, parent)

Private method to add a dependency branch to a given parent.

dependency (dict)
  dependency to be added
parent (QTreeWidget or QTreeWidgetItem)
  reference to the parent item

#### PipPackagesWidget.__allPackageNames

__allPackageNames()

Private method to get a list of all package names.

Return:
  list of all package names

Return Type:
  list of str

#### PipPackagesWidget.__allUpdateableItems

__allUpdateableItems()

Private method to get a list of all items that can be updated.

Return:
  list of all items that can be updated

Return Type:
  list of QTreeWidgetItem

#### PipPackagesWidget.__availablePipVersion

__availablePipVersion()

Private method to get the pip version of the selected environment.

Return:
  tuple containing the version number or tuple with all zeros in case pip is not available

Return Type:
  tuple of int

#### PipPackagesWidget.__checkVulnerability

__checkVulnerability()

Private slot to update and show the vulnerability data (called from the menu).

#### PipPackagesWidget.__clearVulnerabilityInfo

__clearVulnerabilityInfo()

Private slot to clear the vulnerability info.

#### PipPackagesWidget.__createSBOMFile

__createSBOMFile()

Private slot to create a "Software Bill Of Material" file.

#### PipPackagesWidget.__editConfiguration

__editConfiguration(venvName="")

Private slot to edit a configuration.

venvName (str)
  name of the environment to act upon

#### PipPackagesWidget.__editVirtualenvConfiguration

__editVirtualenvConfiguration()

Private slot to edit the configuration of the selected environment.

#### PipPackagesWidget.__generateRequirements

__generateRequirements(doConstraints=False)

Private slot to generate the contents for a requirements or constraints file.

doConstraints (bool (optional))
  flag indicating to work on the constraints (defaults to False)

#### PipPackagesWidget.__initPipMenu

__initPipMenu()

Private method to create the super menu and attach it to the super menu button.

#### PipPackagesWidget.__installLocalPackage

__installLocalPackage()

Private slot to install a package available on local storage.

#### PipPackagesWidget.__installPackages

__installPackages()

Private slot to install packages to be given by the user.

#### PipPackagesWidget.__installPip

__installPip()

Private slot to install pip into the selected environment.

#### PipPackagesWidget.__installPipUser

__installPipUser()

Private slot to install pip into the user site for the selected environment.

#### PipPackagesWidget.__installPyprojectDependencies

__installPyprojectDependencies()

Private slot to install packages as given in a 'pyproject.toml' file.

#### PipPackagesWidget.__installRequirements

__installRequirements()

Private slot to install packages as given in a requirements file.

#### PipPackagesWidget.__isPipAvailable

__isPipAvailable()

Private method to check, if the pip package is available for the selected environment.

Return:
  flag indicating availability

Return Type:
  bool

#### PipPackagesWidget.__pipConfigure

__pipConfigure()

Private slot to open the configuration page.

#### PipPackagesWidget.__populateEnvironments

__populateEnvironments()

Private method to get a list of environments and populate the selector.

#### PipPackagesWidget.__projectClosed

__projectClosed(shutdown)

Private slot to handle the projectClosed signal.

shutdown (bool)
  flag indicating the IDE shutdown

#### PipPackagesWidget.__projectOpened

__projectOpened()

Private slot to handle the projectOpened signal.

#### PipPackagesWidget.__purgeCache

__purgeCache()

Private slot to empty the pip cache.

#### PipPackagesWidget.__refreshDependencyTree

__refreshDependencyTree()

Private slot to refresh the dependency tree.

#### PipPackagesWidget.__refreshPackagesList

__refreshPackagesList()

Private slot to refresh the packages list.

#### PipPackagesWidget.__reinstallPackages

__reinstallPackages()

Private slot to force a re-installation of the selected packages.

#### PipPackagesWidget.__removeCachedFiles

__removeCachedFiles()

Private slot to remove files from the pip cache.

#### PipPackagesWidget.__repairPip

__repairPip()

Private slot to repair the pip installation of the selected environment.

#### PipPackagesWidget.__resetPackageSearchHighlight

__resetPackageSearchHighlight(packageItem)

Private method to reset the package search marker of an individual item.

packageItem (QTreeWidgetItem)
  reference to the package item

#### PipPackagesWidget.__resetPackageSearchHighlights

__resetPackageSearchHighlights(parent=None)

Private method to reset the package search markers.

parent (QTreeWidgetItem (optional))
  reference to the parent item (defaults to None)

#### PipPackagesWidget.__selectedUpdateableItems

__selectedUpdateableItems()

Private method to get a list of selected items that can be updated.

Return:
  list of selected items that can be updated

Return Type:
  list of QTreeWidgetItem

#### PipPackagesWidget.__setPackageSearchHighlights

__setPackageSearchHighlights(packageItems)

Private method to highlight the given package items.

packageItems (list of QTreeWidgetItem)
  list of package dependency items to be highlighted

#### PipPackagesWidget.__showCacheInfo

__showCacheInfo()

Private slot to show information about the cache.

#### PipPackagesWidget.__showCacheList

__showCacheList()

Private slot to show a list of cached files.

#### PipPackagesWidget.__showLicensesDialog

__showLicensesDialog()

Private slot to show a dialog with the licenses of the selected environment.

#### PipPackagesWidget.__showPackageDetails

__showPackageDetails(packageName, packageVersion, vulnerabilities=None, upgradable=False, installable=False, )

Private method to populate the package details dialog.

packageName (str)
  name of the package to show details for
packageVersion (str)
  version of the package
vulnerabilities (list (optional))
  list of known vulnerabilities (defaults to None)
upgradable (bool (optional))
  flag indicating that the package may be upgraded (defaults to False)
installable (bool (optional))
  flag indicating that the package may be installed (defaults to False)

#### PipPackagesWidget.__showPackageInformation

__showPackageInformation(packageName, infoWidget)

Private method to show information for a package.

packageName (str)
  name of the package
infoWidget (QTreeWidget)
  reference to the widget to contain the information

#### PipPackagesWidget.__showVulnerabilityInformation

__showVulnerabilityInformation(packageName, packageVersion, vulnerabilities)

Private method to show the detected vulnerability data.

packageName (str)
  name of the package
packageVersion (str)
  installed version number
vulnerabilities (list of Vulnerability)
  list of vulnerabilities

#### PipPackagesWidget.__uninstallPyprojectDependencies

__uninstallPyprojectDependencies()

Private slot to uninstall packages as given in a 'pyproject.toml' file.

#### PipPackagesWidget.__uninstallRequirements

__uninstallRequirements()

Private slot to uninstall packages as given in a requirements file.

#### PipPackagesWidget.__updateActionButtons

__updateActionButtons()

Private method to set the state of the action buttons.

#### PipPackagesWidget.__updateDepActionButtons

__updateDepActionButtons()

Private method to set the state of the dependency page action buttons.

#### PipPackagesWidget.__updateOutdatedInfo

__updateOutdatedInfo(outdatedPackages)

Private method to process the list of outdated packages.

outdatedPackages (dict of [str: (str, str)])
  dictionary with the package name as key and a tuple containing the installed and available version as the value

#### PipPackagesWidget.__updateVulnerabilityData

__updateVulnerabilityData(clearFirst=True)

Private slot to update the shown vulnerability info.

clearFirst (bool (optional))
  flag indicating to clear the vulnerability info first (defaults to True)

#### PipPackagesWidget.__updateVulnerabilityDbCache

__updateVulnerabilityDbCache()

Private slot to initiate an update of the local cache of the vulnerability database.

#### PipPackagesWidget.executeInstallPackages

executeInstallPackages(packages, userSite=False)

Public method to install the given list of packages.

packages (list of str)
  list of package names to be installed
userSite (bool)
  flag indicating to install to the user directory

#### PipPackagesWidget.executeUninstallPackages

executeUninstallPackages(packages)

Public method to uninstall the given list of packages.

packages (list of str)
  list of package names to be uninstalled

#### PipPackagesWidget.executeUpgradePackages

executeUpgradePackages(packages)

Public method to execute the pip upgrade command.

packages (list of str)
  list of package names to be upgraded

#### PipPackagesWidget.getPip

getPip()

Public method to get a reference to the pip interface object.

Return:
  reference to the pip interface object

Return Type:
  Pip

#### PipPackagesWidget.on_cleanupButton_clicked

on_cleanupButton_clicked()

Private slot to cleanup the site-packages directory of the selected environment.

#### PipPackagesWidget.on_dependenciesList_itemActivated

on_dependenciesList_itemActivated(item, column)

Private slot reacting on a package item of the dependency tree being activated.

item (QTreeWidgetItem)
  reference to the activated item
column (int)
  activated column

#### PipPackagesWidget.on_dependenciesList_itemPressed

on_dependenciesList_itemPressed(item, column)

Private slot reacting on a package item of the dependency tree being pressed.

item (QTreeWidgetItem)
  reference to the pressed item
column (int)
  pressed column

#### PipPackagesWidget.on_dependenciesList_itemSelectionChanged

on_dependenciesList_itemSelectionChanged()

Private slot reacting on a change of selected items of the dependency tree.

#### PipPackagesWidget.on_dependencyRepairAllButton_clicked

on_dependencyRepairAllButton_clicked()

Private slot to repair all dependencies.

#### PipPackagesWidget.on_dependencyRepairButton_clicked

on_dependencyRepairButton_clicked()

Private slot to repair all selected dependencies.

#### PipPackagesWidget.on_environmentsComboBox_currentTextChanged

on_environmentsComboBox_currentTextChanged(name)

Private slot handling the selection of a Python environment.

name (str)
  name of the selected Python environment

#### PipPackagesWidget.on_includeGlobalsButton_clicked

on_includeGlobalsButton_clicked(checked)

Private slot to handle a change of the 'Include Global Environments' button.

checked (bool)
  current check state

#### PipPackagesWidget.on_packageSearchEdit_textChanged

on_packageSearchEdit_textChanged(package)

Private slot to search packages in the dependencies tree.

package (str)
  package text to search for

#### PipPackagesWidget.on_packagesList_itemActivated

on_packagesList_itemActivated(item, column)

Private slot reacting on a package item being activated.

item (QTreeWidgetItem)
  reference to the activated item
column (int)
  activated column

#### PipPackagesWidget.on_packagesList_itemSelectionChanged

on_packagesList_itemSelectionChanged()

Private slot reacting on a change of selected items.

#### PipPackagesWidget.on_refreshButton_clicked

on_refreshButton_clicked()

Private slot to refresh the display.

#### PipPackagesWidget.on_refreshDependenciesButton_clicked

on_refreshDependenciesButton_clicked()

Private slot to refresh the dependency tree.

#### PipPackagesWidget.on_searchButton_clicked

on_searchButton_clicked()

Private slot to open a web browser for package searching.

#### PipPackagesWidget.on_showDepPackageDetailsButton_clicked

on_showDepPackageDetailsButton_clicked()

Private slot to show information for the selected package of the dependency tree.

#### PipPackagesWidget.on_showPackageDetailsButton_clicked

on_showPackageDetailsButton_clicked()

Private slot to show information for the selected package.

#### PipPackagesWidget.on_uninstallButton_clicked

on_uninstallButton_clicked()

Private slot to remove selected packages of the selected environment.

#### PipPackagesWidget.on_upgradeAllButton_clicked

on_upgradeAllButton_clicked()

Private slot to upgrade all packages of the selected environment.

#### PipPackagesWidget.on_upgradeButton_clicked

on_upgradeButton_clicked()

Private slot to upgrade selected packages of the selected environment.

#### PipPackagesWidget.on_viewToggleButton_toggled

on_viewToggleButton_toggled(checked)

Private slot handling the view selection.

checked (bool)
  state of the toggle button

#### PipPackagesWidget.on_vulnerabilityCheckBox_toggled

on_vulnerabilityCheckBox_toggled(checked)

Private slot handling a change of the automatic vulnerability checks.

checked (bool)
  flag indicating the state of the check box

#### PipPackagesWidget.preferencesChanged

preferencesChanged()

Public slot to handle a change of preferences.

#### PipPackagesWidget.setVulnerabilityEnabled

setVulnerabilityEnabled(enable)

Public slot to set the enabled state of the vulnerability checks.

enable (bool)
  vulnerability checks enabled state

Up